
package samples;
// {{{ imports
import jp.ize.ux.components.UXSceneManager;
import jp.ize.ux.components.UXScene;
import jp.ize.ux.UXRoot;
import jp.ize.ux.events.UXMouseEvent;
import jp.ize.iwp.RuntimeEngine;
import jp.ize.iwp.utils.DebugUtil;
import samples.scenes.RootScene;
import samples.scenes.Scene1;
import samples.scenes.Scene2;
import samples.scenes.Scene3;
// }}}
// {{{ class Scene
class Scene
{
	// {{{ public static function main() : Void

	public static function main() : Void
	{
		RuntimeEngine.init();
		DebugUtil.init();
		DebugUtil.setLocation( 80, 350 );
		var s = new Scene();
	}

	// }}}
	// {{{ public function new() : Void

	public function new() : Void
	{
		var scenes:Array<SceneInfo> = [
			{ name:"/",               type:NORMAL, klass:RootScene },
			{ name:"/scene1/",        type:NORMAL, klass:Scene1 },
			{ name:"/scene2/",        type:NORMAL, klass:Scene2 },
			{ name:"/scene2/scene3/", type:SUB,    klass:Scene3 },
		];
		var manager = new UXSceneManager(scenes);
		manager.base.graphics.beginFill(0xFFFF00,0.3);
		manager.base.graphics.drawRect(0,0,UXRoot.width,UXRoot.height);
		manager.base.graphics.endFill();
		UXRoot.addUXChild(manager);
		manager.change("/");
		var index:Int = 1;
		manager.ctrl.getInteraction("Action").addReactEvent(UXMouseEvent.CLICK);
		manager.ctrl.getInteraction("Action").addAct(function(s){
			manager.change(scenes[index].name);
			index++;
			if ( index>scenes.length-1 ) index = 0;
		});
	}

	// }}}
}
// }}}
